<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>滞纳金方案配置</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		$(function () {
			$('#beginDate').datetimepicker({
				format: "YYYY-MM-DD"
			});

			$('#endDate').datetimepicker({
				format: "YYYY-MM-DD"
			});

		})
        function save() {
            var isValidate = jp.validateForm('#inputForm');//校验表单
            if(!isValidate){
				jp.error("必填项不能为空，请检查！");
                return false;
            }else{
                jp.loading();
                jp.post("${ctx}/sys/lateFeePlan/save",$('#inputForm').serialize(),function(data){
                    if(data.success){
                        jp.getParent().refresh();
                        var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
                        parent.layer.close(dialogIndex);
                        jp.success(data.msg)

                    }else{
                        jp.error(data.msg);
                    }
                })
            }

        }
	</script>
</head>
<body class="bg-white">
	<form:form id="inputForm" modelAttribute="lateFeePlan" action="${ctx}/sys/lateFeePlan/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="classid"/>
			<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
			<tbody>
				<tr>
		 			<td  class="width-15 active"><label class="pull-right">档案类别:</label></td>
			 		<td class="width-35" >
						<input id="className" value="${fns:getDictLabels(lateFeePlan.classid, 'Sys_Itemclass_DN', '')}" class="form-control " readonly="readonly"/>
					</td>
					<td  class="width-15 active">	<label class="pull-right"><font color="red">*</font>源款项:</label></td>
					<td  class="width-35" >
						<select id="scostitemid" name="scostitemid" data-value="${lateFeePlan.scostitemid}" class="form-control">
						</select>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active"><label class="pull-right"><font color="red">*</font>选择:</label></td>
					<td class="width-35" >
						<form:select path="selected" class="form-control ">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('Sys_YesNo')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
					<td  class="width-15 active">	<label class="pull-right"><font color="red">*</font>启用:</label></td>
					<td  class="width-35" >
						<form:select path="status" class="form-control ">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('Sys_YesNo')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active"><label class="pull-right">本金:</label></td>
					<td class="width-35" >
						<form:select path="inCorpus" class="form-control ">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('Sys_YesNo')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
					<td  class="width-15 active">	<label class="pull-right">利息:</label></td>
					<td  class="width-35" >
						<form:select path="inInterest" class="form-control ">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('Sys_YesNo')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active"><label class="pull-right">遇负是否计算:</label></td>
					<td class="width-35" >
						<form:select path="inBalance" class="form-control ">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('Sys_YesNo')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
					<td  class="width-15 active">	<label class="pull-right"><font color="red">*</font>滞纳金款项:</label></td>
					<td  class="width-35" >
						<form:select path="costitemid" class="form-control ">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('Sys_CostItemID')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active"><label class="pull-right"><font color="red">*</font>日罚利率:</label></td>
					<td class="width-35" >
						<form:input path="dayRate" htmlEscape="false" class="form-control "/>
					</td>
					<td  class="width-15 active"></td>
					<td class="width-35" ></td>
				</tr>
				<tr>
					<td  class="width-15 active">	<label class="pull-right"><font color="red">*</font>开始日期:</label></td>
					<td  class="width-35" >
						<div class='input-group form_datetime' id='beginDate'>
							<input type='text'  name="beginDate" class="form-control "  value="<fmt:formatDate value="${lateFeePlan.beginDate}" pattern="yyyy-MM-dd"/>"/>
							<span class="input-group-addon">
											<span class="glyphicon glyphicon-calendar"></span>
										</span>
						</div>
					</td>
					<td  class="width-15 active">	<label class="pull-right"><font color="red">*</font>结束日期:</label></td>
					<td  class="width-35" >
						<div class='input-group form_datetime' id='endDate'>
							<input type='text'  name="endDate" class="form-control "  value="<fmt:formatDate value="${lateFeePlan.endDate}" pattern="yyyy-MM-dd"/>"/>
							<span class="input-group-addon">
											<span class="glyphicon glyphicon-calendar"></span>
										</span>
						</div>
					</td>
				</tr>
		   	</tbody>
		   	</table>
	</form:form>
	<script type="text/javascript">
		$(function () {
			$.ajax({
				type: "get",
				url: "${ctx}/sys/archCostItem/getArchCostItem?dictValueId=" + $("#classid").val(),
				async: true,
				dataType: "JSON",
				success: function (res) {
					var str = null;
					var data = res.rows;
					str += "<option value=''></option>";
					for (var i = 0; i < data.length; i++) {
						str += "<option value='" + data[i].costitemId + "'>" + data[i].costitemName + "</option>";
					}
					$("#scostitemid").html(str);
					str = null;
					$("#scostitemid").val($("#scostitemid").attr("data-value"));
				}
			});

		})
	</script>
</body>
</html>
